Ricoh Jetmapping Table Calculations

RI_GEN4

Pixel Row Position


In [1]:
def calc_pixel_row_position(mm_ab): # distance ch_a - ch_b
  resolution     = 150 # dpi
  inch2cm        = 2.54 # cm/inch
  pixel_pitch    = (inch2cm/float(resolution))*10 # in mm
  print ("{0}dpi = {1}mm pixel pitch".format(resolution, pixel_pitch))
  channel_a      = 0
  channel_b      = (mm_ab)/pixel_pitch
  
  print("Pixel Row position")
  print("Channel A = {0}".format(channel_a))
  print("Channel B = {0} >> rounded = {1}".format(channel_b, int(round(channel_b))))
        
calc_pixel_row_position(mm_ab=0.9948)


150dpi = 0.16933333333333334mm pixel pitch
Pixel Row position
Channel A = 0
Channel B = 5.874803149606299 >> rounded = 6

Calc Nozzle Pixel Address


In [2]:
# This method is wrong channel a and b switched
def calc_pixel_address_old():
  print("| Nozzle || Channel A | Channel B | Channel A Flip Y | Channel B Flip Y |")
  print("+--------++-----------+-----------+------------------+------------------+")
  for nozzle in range(192): # 0 - 191
    # Mask Address Calculation
    channel_a = (    nozzle)*2+0
    channel_b = (191-nozzle)*2+1
    # Flip Y
    # Mask Address Calculation
    channel_a_flip_y = (191-nozzle)*2+0
    channel_b_flip_y = (    nozzle)*2+1
    print(" {0:7} || {1:9} | {2:9} | {3:16} | {4:16} |".format(nozzle, channel_a, channel_b, channel_a_flip_y, channel_b_flip_y))

#calc_pixel_address_old()

# This is the correct method
def calc_pixel_address():
  print("| Nozzle || Channel A | Channel B | Channel A Flip Y | Channel B Flip Y |")
  print("+--------++-----------+-----------+------------------+------------------+")
  for nozzle in range(192): # 0 - 191
    # Mask Address Calculation
    channel_a = (191-nozzle)*2+1
    channel_b = (    nozzle)*2+0
    # Flip Y
    # Mask Address Calculation
    channel_a_flip_y = (    nozzle)*2+1
    channel_b_flip_y = (191-nozzle)*2+0
    print(" {0:7} || {1:9} | {2:9} | {3:16} | {4:16} |".format(nozzle, channel_a, channel_b, channel_a_flip_y, channel_b_flip_y))
calc_pixel_address()


| Nozzle || Channel A | Channel B | Channel A Flip Y | Channel B Flip Y |
+--------++-----------+-----------+------------------+------------------+
       0 ||       383 |         0 |                1 |              382 |
       1 ||       381 |         2 |                3 |              380 |
       2 ||       379 |         4 |                5 |              378 |
       3 ||       377 |         6 |                7 |              376 |
       4 ||       375 |         8 |                9 |              374 |
       5 ||       373 |        10 |               11 |              372 |
       6 ||       371 |        12 |               13 |              370 |
       7 ||       369 |        14 |               15 |              368 |
       8 ||       367 |        16 |               17 |              366 |
       9 ||       365 |        18 |               19 |              364 |
      10 ||       363 |        20 |               21 |              362 |
      11 ||       361 |        22 |               23 |              360 |
      12 ||       359 |        24 |               25 |              358 |
      13 ||       357 |        26 |               27 |              356 |
      14 ||       355 |        28 |               29 |              354 |
      15 ||       353 |        30 |               31 |              352 |
      16 ||       351 |        32 |               33 |              350 |
      17 ||       349 |        34 |               35 |              348 |
      18 ||       347 |        36 |               37 |              346 |
      19 ||       345 |        38 |               39 |              344 |
      20 ||       343 |        40 |               41 |              342 |
      21 ||       341 |        42 |               43 |              340 |
      22 ||       339 |        44 |               45 |              338 |
      23 ||       337 |        46 |               47 |              336 |
      24 ||       335 |        48 |               49 |              334 |
      25 ||       333 |        50 |               51 |              332 |
      26 ||       331 |        52 |               53 |              330 |
      27 ||       329 |        54 |               55 |              328 |
      28 ||       327 |        56 |               57 |              326 |
      29 ||       325 |        58 |               59 |              324 |
      30 ||       323 |        60 |               61 |              322 |
      31 ||       321 |        62 |               63 |              320 |
      32 ||       319 |        64 |               65 |              318 |
      33 ||       317 |        66 |               67 |              316 |
      34 ||       315 |        68 |               69 |              314 |
      35 ||       313 |        70 |               71 |              312 |
      36 ||       311 |        72 |               73 |              310 |
      37 ||       309 |        74 |               75 |              308 |
      38 ||       307 |        76 |               77 |              306 |
      39 ||       305 |        78 |               79 |              304 |
      40 ||       303 |        80 |               81 |              302 |
      41 ||       301 |        82 |               83 |              300 |
      42 ||       299 |        84 |               85 |              298 |
      43 ||       297 |        86 |               87 |              296 |
      44 ||       295 |        88 |               89 |              294 |
      45 ||       293 |        90 |               91 |              292 |
      46 ||       291 |        92 |               93 |              290 |
      47 ||       289 |        94 |               95 |              288 |
      48 ||       287 |        96 |               97 |              286 |
      49 ||       285 |        98 |               99 |              284 |
      50 ||       283 |       100 |              101 |              282 |
      51 ||       281 |       102 |              103 |              280 |
      52 ||       279 |       104 |              105 |              278 |
      53 ||       277 |       106 |              107 |              276 |
      54 ||       275 |       108 |              109 |              274 |
      55 ||       273 |       110 |              111 |              272 |
      56 ||       271 |       112 |              113 |              270 |
      57 ||       269 |       114 |              115 |              268 |
      58 ||       267 |       116 |              117 |              266 |
      59 ||       265 |       118 |              119 |              264 |
      60 ||       263 |       120 |              121 |              262 |
      61 ||       261 |       122 |              123 |              260 |
      62 ||       259 |       124 |              125 |              258 |
      63 ||       257 |       126 |              127 |              256 |
      64 ||       255 |       128 |              129 |              254 |
      65 ||       253 |       130 |              131 |              252 |
      66 ||       251 |       132 |              133 |              250 |
      67 ||       249 |       134 |              135 |              248 |
      68 ||       247 |       136 |              137 |              246 |
      69 ||       245 |       138 |              139 |              244 |
      70 ||       243 |       140 |              141 |              242 |
      71 ||       241 |       142 |              143 |              240 |
      72 ||       239 |       144 |              145 |              238 |
      73 ||       237 |       146 |              147 |              236 |
      74 ||       235 |       148 |              149 |              234 |
      75 ||       233 |       150 |              151 |              232 |
      76 ||       231 |       152 |              153 |              230 |
      77 ||       229 |       154 |              155 |              228 |
      78 ||       227 |       156 |              157 |              226 |
      79 ||       225 |       158 |              159 |              224 |
      80 ||       223 |       160 |              161 |              222 |
      81 ||       221 |       162 |              163 |              220 |
      82 ||       219 |       164 |              165 |              218 |
      83 ||       217 |       166 |              167 |              216 |
      84 ||       215 |       168 |              169 |              214 |
      85 ||       213 |       170 |              171 |              212 |
      86 ||       211 |       172 |              173 |              210 |
      87 ||       209 |       174 |              175 |              208 |
      88 ||       207 |       176 |              177 |              206 |
      89 ||       205 |       178 |              179 |              204 |
      90 ||       203 |       180 |              181 |              202 |
      91 ||       201 |       182 |              183 |              200 |
      92 ||       199 |       184 |              185 |              198 |
      93 ||       197 |       186 |              187 |              196 |
      94 ||       195 |       188 |              189 |              194 |
      95 ||       193 |       190 |              191 |              192 |
      96 ||       191 |       192 |              193 |              190 |
      97 ||       189 |       194 |              195 |              188 |
      98 ||       187 |       196 |              197 |              186 |
      99 ||       185 |       198 |              199 |              184 |
     100 ||       183 |       200 |              201 |              182 |
     101 ||       181 |       202 |              203 |              180 |
     102 ||       179 |       204 |              205 |              178 |
     103 ||       177 |       206 |              207 |              176 |
     104 ||       175 |       208 |              209 |              174 |
     105 ||       173 |       210 |              211 |              172 |
     106 ||       171 |       212 |              213 |              170 |
     107 ||       169 |       214 |              215 |              168 |
     108 ||       167 |       216 |              217 |              166 |
     109 ||       165 |       218 |              219 |              164 |
     110 ||       163 |       220 |              221 |              162 |
     111 ||       161 |       222 |              223 |              160 |
     112 ||       159 |       224 |              225 |              158 |
     113 ||       157 |       226 |              227 |              156 |
     114 ||       155 |       228 |              229 |              154 |
     115 ||       153 |       230 |              231 |              152 |
     116 ||       151 |       232 |              233 |              150 |
     117 ||       149 |       234 |              235 |              148 |
     118 ||       147 |       236 |              237 |              146 |
     119 ||       145 |       238 |              239 |              144 |
     120 ||       143 |       240 |              241 |              142 |
     121 ||       141 |       242 |              243 |              140 |
     122 ||       139 |       244 |              245 |              138 |
     123 ||       137 |       246 |              247 |              136 |
     124 ||       135 |       248 |              249 |              134 |
     125 ||       133 |       250 |              251 |              132 |
     126 ||       131 |       252 |              253 |              130 |
     127 ||       129 |       254 |              255 |              128 |
     128 ||       127 |       256 |              257 |              126 |
     129 ||       125 |       258 |              259 |              124 |
     130 ||       123 |       260 |              261 |              122 |
     131 ||       121 |       262 |              263 |              120 |
     132 ||       119 |       264 |              265 |              118 |
     133 ||       117 |       266 |              267 |              116 |
     134 ||       115 |       268 |              269 |              114 |
     135 ||       113 |       270 |              271 |              112 |
     136 ||       111 |       272 |              273 |              110 |
     137 ||       109 |       274 |              275 |              108 |
     138 ||       107 |       276 |              277 |              106 |
     139 ||       105 |       278 |              279 |              104 |
     140 ||       103 |       280 |              281 |              102 |
     141 ||       101 |       282 |              283 |              100 |
     142 ||        99 |       284 |              285 |               98 |
     143 ||        97 |       286 |              287 |               96 |
     144 ||        95 |       288 |              289 |               94 |
     145 ||        93 |       290 |              291 |               92 |
     146 ||        91 |       292 |              293 |               90 |
     147 ||        89 |       294 |              295 |               88 |
     148 ||        87 |       296 |              297 |               86 |
     149 ||        85 |       298 |              299 |               84 |
     150 ||        83 |       300 |              301 |               82 |
     151 ||        81 |       302 |              303 |               80 |
     152 ||        79 |       304 |              305 |               78 |
     153 ||        77 |       306 |              307 |               76 |
     154 ||        75 |       308 |              309 |               74 |
     155 ||        73 |       310 |              311 |               72 |
     156 ||        71 |       312 |              313 |               70 |
     157 ||        69 |       314 |              315 |               68 |
     158 ||        67 |       316 |              317 |               66 |
     159 ||        65 |       318 |              319 |               64 |
     160 ||        63 |       320 |              321 |               62 |
     161 ||        61 |       322 |              323 |               60 |
     162 ||        59 |       324 |              325 |               58 |
     163 ||        57 |       326 |              327 |               56 |
     164 ||        55 |       328 |              329 |               54 |
     165 ||        53 |       330 |              331 |               52 |
     166 ||        51 |       332 |              333 |               50 |
     167 ||        49 |       334 |              335 |               48 |
     168 ||        47 |       336 |              337 |               46 |
     169 ||        45 |       338 |              339 |               44 |
     170 ||        43 |       340 |              341 |               42 |
     171 ||        41 |       342 |              343 |               40 |
     172 ||        39 |       344 |              345 |               38 |
     173 ||        37 |       346 |              347 |               36 |
     174 ||        35 |       348 |              349 |               34 |
     175 ||        33 |       350 |              351 |               32 |
     176 ||        31 |       352 |              353 |               30 |
     177 ||        29 |       354 |              355 |               28 |
     178 ||        27 |       356 |              357 |               26 |
     179 ||        25 |       358 |              359 |               24 |
     180 ||        23 |       360 |              361 |               22 |
     181 ||        21 |       362 |              363 |               20 |
     182 ||        19 |       364 |              365 |               18 |
     183 ||        17 |       366 |              367 |               16 |
     184 ||        15 |       368 |              369 |               14 |
     185 ||        13 |       370 |              371 |               12 |
     186 ||        11 |       372 |              373 |               10 |
     187 ||         9 |       374 |              375 |                8 |
     188 ||         7 |       376 |              377 |                6 |
     189 ||         5 |       378 |              379 |                4 |
     190 ||         3 |       380 |              381 |                2 |
     191 ||         1 |       382 |              383 |                0 |

RI_GEN5

Pixel Row Position


In [3]:
def calc_pixel_row_position(mm_ab, mm_bc, mm_cd): # distance ch_a - ch_b, ch_b - ch_c, ch_c - ch_d
  resolution     = 600 # dpi
  inch2cm        = 2.54 # cm/inch
  pixel_pitch    = (inch2cm/float(resolution))*10 # in mm
  channel_a      = 0
  channel_b      = (mm_ab)/pixel_pitch
  channel_c      = (mm_ab+mm_bc)/pixel_pitch
  channel_d      = (mm_ab+mm_bc+mm_cd)/pixel_pitch
  
  print("Pixel Row position")
  print("Channel A = {0}".format(channel_a))
  print("Channel B = {0}".format(channel_b))
  print("Channel C = {0}".format(channel_c))
  print("Channel D = {0}".format(channel_d))
calc_pixel_row_position(mm_ab=0.5503, mm_bc=11.811-0.5503, mm_cd=0.5503)


Pixel Row position
Channel A = 0
Channel B = 12.999212598425197
Channel C = 279.0
Channel D = 291.9992125984252

Calc Nozzle Pixel Address


In [4]:
def calc_pixel_address(flip_y=False, flip_x=False, short=True):
  print("+------------------------------------------------------------------------+")
  if (flip_y and flip_x):
    print("|                            Flip X and Flip Y                           |")
  elif flip_y:
    print("|                                 Flip Y                                 |")
  elif flip_x:
    print("|                                 Flip X                                 |")
  else:
    print("|                                 no Flip                                |")
  print("+--------+---------------+---------------+---------------+---------------+")
  print("| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |")
  print("|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |")
  print("+--------+-------+-------+-------+-------+-------+-------+-------+-------+")

  for nozzle in range(320): # 0 - 319
    if flip_y == False:
      nozzle_address_ch0 = 319 - nozzle
      nozzle_address_ch2 = 319 - nozzle
      nozzle_address_ch1 = nozzle
      nozzle_address_ch3 = nozzle
      pos_y_ch0 = nozzle_address_ch0 * 4 + 0
      pos_y_ch1 = nozzle_address_ch1 * 4 + 2
      pos_y_ch2 = nozzle_address_ch2 * 4 + 1
      pos_y_ch3 = nozzle_address_ch3 * 4 + 3  
    else:
      nozzle_address_ch0 = nozzle
      nozzle_address_ch2 = nozzle
      nozzle_address_ch1 = 319 - nozzle
      nozzle_address_ch3 = 319 - nozzle
      pos_y_ch0 = nozzle_address_ch0 * 4 + 3
      pos_y_ch1 = nozzle_address_ch1 * 4 + 1
      pos_y_ch2 = nozzle_address_ch2 * 4 + 2
      pos_y_ch3 = nozzle_address_ch3 * 4 + 0  
      
    if flip_x == False:
      pos_x_ch0 = 0
      pos_x_ch1 = 13
      pos_x_ch2 = 279
      pos_x_ch3 = 292
    else:
      pos_x_ch0 = 292
      pos_x_ch1 = 279
      pos_x_ch2 = 13
      pos_x_ch3 = 0

    if ((nozzle < 5 or nozzle > 314) and short) or not short:
      print("| {0:6} | {1:5} | {2:5} | {3:5} | {4:5} | {5:5} | {6:5} | {7:5} | {8:5} |".format(nozzle, pos_x_ch0, pos_y_ch0, pos_x_ch1, pos_y_ch1, pos_x_ch2, pos_y_ch2, pos_x_ch3, pos_y_ch3))
    elif nozzle == 5 and short:
      print("|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |")

calc_pixel_address(flip_y = False, flip_x = False)
calc_pixel_address(flip_y = False, flip_x = True)
calc_pixel_address(flip_y = True, flip_x = False)
calc_pixel_address(flip_y = True, flip_x = True)


+------------------------------------------------------------------------+
|                                 no Flip                                |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |     0 |  1276 |    13 |     2 |   279 |  1277 |   292 |     3 |
|      1 |     0 |  1272 |    13 |     6 |   279 |  1273 |   292 |     7 |
|      2 |     0 |  1268 |    13 |    10 |   279 |  1269 |   292 |    11 |
|      3 |     0 |  1264 |    13 |    14 |   279 |  1265 |   292 |    15 |
|      4 |     0 |  1260 |    13 |    18 |   279 |  1261 |   292 |    19 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |     0 |    16 |    13 |  1262 |   279 |    17 |   292 |  1263 |
|    316 |     0 |    12 |    13 |  1266 |   279 |    13 |   292 |  1267 |
|    317 |     0 |     8 |    13 |  1270 |   279 |     9 |   292 |  1271 |
|    318 |     0 |     4 |    13 |  1274 |   279 |     5 |   292 |  1275 |
|    319 |     0 |     0 |    13 |  1278 |   279 |     1 |   292 |  1279 |
+------------------------------------------------------------------------+
|                                 Flip X                                 |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |   292 |  1276 |   279 |     2 |    13 |  1277 |     0 |     3 |
|      1 |   292 |  1272 |   279 |     6 |    13 |  1273 |     0 |     7 |
|      2 |   292 |  1268 |   279 |    10 |    13 |  1269 |     0 |    11 |
|      3 |   292 |  1264 |   279 |    14 |    13 |  1265 |     0 |    15 |
|      4 |   292 |  1260 |   279 |    18 |    13 |  1261 |     0 |    19 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |   292 |    16 |   279 |  1262 |    13 |    17 |     0 |  1263 |
|    316 |   292 |    12 |   279 |  1266 |    13 |    13 |     0 |  1267 |
|    317 |   292 |     8 |   279 |  1270 |    13 |     9 |     0 |  1271 |
|    318 |   292 |     4 |   279 |  1274 |    13 |     5 |     0 |  1275 |
|    319 |   292 |     0 |   279 |  1278 |    13 |     1 |     0 |  1279 |
+------------------------------------------------------------------------+
|                                 Flip Y                                 |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |     0 |     3 |    13 |  1277 |   279 |     2 |   292 |  1276 |
|      1 |     0 |     7 |    13 |  1273 |   279 |     6 |   292 |  1272 |
|      2 |     0 |    11 |    13 |  1269 |   279 |    10 |   292 |  1268 |
|      3 |     0 |    15 |    13 |  1265 |   279 |    14 |   292 |  1264 |
|      4 |     0 |    19 |    13 |  1261 |   279 |    18 |   292 |  1260 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |     0 |  1263 |    13 |    17 |   279 |  1262 |   292 |    16 |
|    316 |     0 |  1267 |    13 |    13 |   279 |  1266 |   292 |    12 |
|    317 |     0 |  1271 |    13 |     9 |   279 |  1270 |   292 |     8 |
|    318 |     0 |  1275 |    13 |     5 |   279 |  1274 |   292 |     4 |
|    319 |     0 |  1279 |    13 |     1 |   279 |  1278 |   292 |     0 |
+------------------------------------------------------------------------+
|                            Flip X and Flip Y                           |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |   292 |     3 |   279 |  1277 |    13 |     2 |     0 |  1276 |
|      1 |   292 |     7 |   279 |  1273 |    13 |     6 |     0 |  1272 |
|      2 |   292 |    11 |   279 |  1269 |    13 |    10 |     0 |  1268 |
|      3 |   292 |    15 |   279 |  1265 |    13 |    14 |     0 |  1264 |
|      4 |   292 |    19 |   279 |  1261 |    13 |    18 |     0 |  1260 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |   292 |  1263 |   279 |    17 |    13 |  1262 |     0 |    16 |
|    316 |   292 |  1267 |   279 |    13 |    13 |  1266 |     0 |    12 |
|    317 |   292 |  1271 |   279 |     9 |    13 |  1270 |     0 |     8 |
|    318 |   292 |  1275 |   279 |     5 |    13 |  1274 |     0 |     4 |
|    319 |   292 |  1279 |   279 |     1 |    13 |  1278 |     0 |     0 |

In [5]:
def old_calc_pixel_address(flip_y=False, flip_x=False,short = True):
  print("+------------------------------------------------------------------------+")
  if (flip_y and flip_x):
    print("|                            Flip X and Flip Y                           |")
  elif flip_y:
    print("|                                 Flip Y                                 |")
  elif flip_x:
    print("|                                 Flip X                                 |")
  else:
    print("|                                 no Flip                                |")
  print("+--------+---------------+---------------+---------------+---------------+")
  print("| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |")
  print("|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |")
  print("+--------+-------+-------+-------+-------+-------+-------+-------+-------+")

  for nozzle in range(320): # 0 - 319
    if flip_y == False:
      nozzle_address_ch0 = 319 - nozzle
      nozzle_address_ch2 = 319 - nozzle
      nozzle_address_ch1 = nozzle
      nozzle_address_ch3 = nozzle
    else:
      nozzle_address_ch0 = nozzle
      nozzle_address_ch2 = nozzle
      nozzle_address_ch1 = 319 - nozzle
      nozzle_address_ch3 = 319 - nozzle
    
    pos_y_ch0 = nozzle_address_ch0 * 4 + 0
    pos_y_ch1 = nozzle_address_ch1 * 4 + 2
    pos_y_ch2 = nozzle_address_ch2 * 4 + 1
    pos_y_ch3 = nozzle_address_ch3 * 4 + 3  
      
    if flip_x == False:
      pos_x_ch0 = 0
      pos_x_ch1 = 13
      pos_x_ch2 = 279
      pos_x_ch3 = 292
    else:
      pos_x_ch0 = 292
      pos_x_ch1 = 279
      pos_x_ch2 = 13
      pos_x_ch3 = 0

    if ((nozzle < 5 or nozzle > 314) and short) or not short:
      print("| {0:6} | {1:5} | {2:5} | {3:5} | {4:5} | {5:5} | {6:5} | {7:5} | {8:5} |".format(nozzle, pos_x_ch0, pos_y_ch0, pos_x_ch1, pos_y_ch1, pos_x_ch2, pos_y_ch2, pos_x_ch3, pos_y_ch3))
    elif nozzle == 5 and short:
      print("|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |")

old_calc_pixel_address(flip_y = False, flip_x = False)
old_calc_pixel_address(flip_y = False, flip_x = True)
old_calc_pixel_address(flip_y = True, flip_x = False)
old_calc_pixel_address(flip_y = True, flip_x = True)


+------------------------------------------------------------------------+
|                                 no Flip                                |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |     0 |  1276 |    13 |     2 |   279 |  1277 |   292 |     3 |
|      1 |     0 |  1272 |    13 |     6 |   279 |  1273 |   292 |     7 |
|      2 |     0 |  1268 |    13 |    10 |   279 |  1269 |   292 |    11 |
|      3 |     0 |  1264 |    13 |    14 |   279 |  1265 |   292 |    15 |
|      4 |     0 |  1260 |    13 |    18 |   279 |  1261 |   292 |    19 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |     0 |    16 |    13 |  1262 |   279 |    17 |   292 |  1263 |
|    316 |     0 |    12 |    13 |  1266 |   279 |    13 |   292 |  1267 |
|    317 |     0 |     8 |    13 |  1270 |   279 |     9 |   292 |  1271 |
|    318 |     0 |     4 |    13 |  1274 |   279 |     5 |   292 |  1275 |
|    319 |     0 |     0 |    13 |  1278 |   279 |     1 |   292 |  1279 |
+------------------------------------------------------------------------+
|                                 Flip X                                 |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |   292 |  1276 |   279 |     2 |    13 |  1277 |     0 |     3 |
|      1 |   292 |  1272 |   279 |     6 |    13 |  1273 |     0 |     7 |
|      2 |   292 |  1268 |   279 |    10 |    13 |  1269 |     0 |    11 |
|      3 |   292 |  1264 |   279 |    14 |    13 |  1265 |     0 |    15 |
|      4 |   292 |  1260 |   279 |    18 |    13 |  1261 |     0 |    19 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |   292 |    16 |   279 |  1262 |    13 |    17 |     0 |  1263 |
|    316 |   292 |    12 |   279 |  1266 |    13 |    13 |     0 |  1267 |
|    317 |   292 |     8 |   279 |  1270 |    13 |     9 |     0 |  1271 |
|    318 |   292 |     4 |   279 |  1274 |    13 |     5 |     0 |  1275 |
|    319 |   292 |     0 |   279 |  1278 |    13 |     1 |     0 |  1279 |
+------------------------------------------------------------------------+
|                                 Flip Y                                 |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |     0 |     0 |    13 |  1278 |   279 |     1 |   292 |  1279 |
|      1 |     0 |     4 |    13 |  1274 |   279 |     5 |   292 |  1275 |
|      2 |     0 |     8 |    13 |  1270 |   279 |     9 |   292 |  1271 |
|      3 |     0 |    12 |    13 |  1266 |   279 |    13 |   292 |  1267 |
|      4 |     0 |    16 |    13 |  1262 |   279 |    17 |   292 |  1263 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |     0 |  1260 |    13 |    18 |   279 |  1261 |   292 |    19 |
|    316 |     0 |  1264 |    13 |    14 |   279 |  1265 |   292 |    15 |
|    317 |     0 |  1268 |    13 |    10 |   279 |  1269 |   292 |    11 |
|    318 |     0 |  1272 |    13 |     6 |   279 |  1273 |   292 |     7 |
|    319 |     0 |  1276 |    13 |     2 |   279 |  1277 |   292 |     3 |
+------------------------------------------------------------------------+
|                            Flip X and Flip Y                           |
+--------+---------------+---------------+---------------+---------------+
| Nozzle |    Channel A  |    Channel B  |    Channel C  |    Channel D  |
|        | Pos X | Pox Y | Pos X | Pos Y | Pos X | Pos Y | Pos X | Pos Y |
+--------+-------+-------+-------+-------+-------+-------+-------+-------+
|      0 |   292 |     0 |   279 |  1278 |    13 |     1 |     0 |  1279 |
|      1 |   292 |     4 |   279 |  1274 |    13 |     5 |     0 |  1275 |
|      2 |   292 |     8 |   279 |  1270 |    13 |     9 |     0 |  1271 |
|      3 |   292 |    12 |   279 |  1266 |    13 |    13 |     0 |  1267 |
|      4 |   292 |    16 |   279 |  1262 |    13 |    17 |     0 |  1263 |
|    ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |   ... |
|    315 |   292 |  1260 |   279 |    18 |    13 |  1261 |     0 |    19 |
|    316 |   292 |  1264 |   279 |    14 |    13 |  1265 |     0 |    15 |
|    317 |   292 |  1268 |   279 |    10 |    13 |  1269 |     0 |    11 |
|    318 |   292 |  1272 |   279 |     6 |    13 |  1273 |     0 |     7 |
|    319 |   292 |  1276 |   279 |     2 |    13 |  1277 |     0 |     3 |

Calc Nozzle Pixel Address (OLD)


In [6]:
def calc_pixel_address_old():
  print("| Nozzle | Channel A | Channel B | Channel C | Channel D |")
  print("+--------+-----------+-----------+-----------+-----------+")
  for nozzle in range(320): # 0 - 319
    # Mask Address Calculation
    channel_a = (319-nozzle)*4+0
    channel_b = (    nozzle)*4+2
    channel_c = (319-nozzle)*4+1
    channel_d = (    nozzle)*4+3
    
    print(" {0:7} | {1:9} | {2:9} | {3:9} | {4:9} |".format(nozzle, channel_a, channel_b, channel_c, channel_d))
    
calc_pixel_address_old()


| Nozzle | Channel A | Channel B | Channel C | Channel D |
+--------+-----------+-----------+-----------+-----------+
       0 |      1276 |         2 |      1277 |         3 |
       1 |      1272 |         6 |      1273 |         7 |
       2 |      1268 |        10 |      1269 |        11 |
       3 |      1264 |        14 |      1265 |        15 |
       4 |      1260 |        18 |      1261 |        19 |
       5 |      1256 |        22 |      1257 |        23 |
       6 |      1252 |        26 |      1253 |        27 |
       7 |      1248 |        30 |      1249 |        31 |
       8 |      1244 |        34 |      1245 |        35 |
       9 |      1240 |        38 |      1241 |        39 |
      10 |      1236 |        42 |      1237 |        43 |
      11 |      1232 |        46 |      1233 |        47 |
      12 |      1228 |        50 |      1229 |        51 |
      13 |      1224 |        54 |      1225 |        55 |
      14 |      1220 |        58 |      1221 |        59 |
      15 |      1216 |        62 |      1217 |        63 |
      16 |      1212 |        66 |      1213 |        67 |
      17 |      1208 |        70 |      1209 |        71 |
      18 |      1204 |        74 |      1205 |        75 |
      19 |      1200 |        78 |      1201 |        79 |
      20 |      1196 |        82 |      1197 |        83 |
      21 |      1192 |        86 |      1193 |        87 |
      22 |      1188 |        90 |      1189 |        91 |
      23 |      1184 |        94 |      1185 |        95 |
      24 |      1180 |        98 |      1181 |        99 |
      25 |      1176 |       102 |      1177 |       103 |
      26 |      1172 |       106 |      1173 |       107 |
      27 |      1168 |       110 |      1169 |       111 |
      28 |      1164 |       114 |      1165 |       115 |
      29 |      1160 |       118 |      1161 |       119 |
      30 |      1156 |       122 |      1157 |       123 |
      31 |      1152 |       126 |      1153 |       127 |
      32 |      1148 |       130 |      1149 |       131 |
      33 |      1144 |       134 |      1145 |       135 |
      34 |      1140 |       138 |      1141 |       139 |
      35 |      1136 |       142 |      1137 |       143 |
      36 |      1132 |       146 |      1133 |       147 |
      37 |      1128 |       150 |      1129 |       151 |
      38 |      1124 |       154 |      1125 |       155 |
      39 |      1120 |       158 |      1121 |       159 |
      40 |      1116 |       162 |      1117 |       163 |
      41 |      1112 |       166 |      1113 |       167 |
      42 |      1108 |       170 |      1109 |       171 |
      43 |      1104 |       174 |      1105 |       175 |
      44 |      1100 |       178 |      1101 |       179 |
      45 |      1096 |       182 |      1097 |       183 |
      46 |      1092 |       186 |      1093 |       187 |
      47 |      1088 |       190 |      1089 |       191 |
      48 |      1084 |       194 |      1085 |       195 |
      49 |      1080 |       198 |      1081 |       199 |
      50 |      1076 |       202 |      1077 |       203 |
      51 |      1072 |       206 |      1073 |       207 |
      52 |      1068 |       210 |      1069 |       211 |
      53 |      1064 |       214 |      1065 |       215 |
      54 |      1060 |       218 |      1061 |       219 |
      55 |      1056 |       222 |      1057 |       223 |
      56 |      1052 |       226 |      1053 |       227 |
      57 |      1048 |       230 |      1049 |       231 |
      58 |      1044 |       234 |      1045 |       235 |
      59 |      1040 |       238 |      1041 |       239 |
      60 |      1036 |       242 |      1037 |       243 |
      61 |      1032 |       246 |      1033 |       247 |
      62 |      1028 |       250 |      1029 |       251 |
      63 |      1024 |       254 |      1025 |       255 |
      64 |      1020 |       258 |      1021 |       259 |
      65 |      1016 |       262 |      1017 |       263 |
      66 |      1012 |       266 |      1013 |       267 |
      67 |      1008 |       270 |      1009 |       271 |
      68 |      1004 |       274 |      1005 |       275 |
      69 |      1000 |       278 |      1001 |       279 |
      70 |       996 |       282 |       997 |       283 |
      71 |       992 |       286 |       993 |       287 |
      72 |       988 |       290 |       989 |       291 |
      73 |       984 |       294 |       985 |       295 |
      74 |       980 |       298 |       981 |       299 |
      75 |       976 |       302 |       977 |       303 |
      76 |       972 |       306 |       973 |       307 |
      77 |       968 |       310 |       969 |       311 |
      78 |       964 |       314 |       965 |       315 |
      79 |       960 |       318 |       961 |       319 |
      80 |       956 |       322 |       957 |       323 |
      81 |       952 |       326 |       953 |       327 |
      82 |       948 |       330 |       949 |       331 |
      83 |       944 |       334 |       945 |       335 |
      84 |       940 |       338 |       941 |       339 |
      85 |       936 |       342 |       937 |       343 |
      86 |       932 |       346 |       933 |       347 |
      87 |       928 |       350 |       929 |       351 |
      88 |       924 |       354 |       925 |       355 |
      89 |       920 |       358 |       921 |       359 |
      90 |       916 |       362 |       917 |       363 |
      91 |       912 |       366 |       913 |       367 |
      92 |       908 |       370 |       909 |       371 |
      93 |       904 |       374 |       905 |       375 |
      94 |       900 |       378 |       901 |       379 |
      95 |       896 |       382 |       897 |       383 |
      96 |       892 |       386 |       893 |       387 |
      97 |       888 |       390 |       889 |       391 |
      98 |       884 |       394 |       885 |       395 |
      99 |       880 |       398 |       881 |       399 |
     100 |       876 |       402 |       877 |       403 |
     101 |       872 |       406 |       873 |       407 |
     102 |       868 |       410 |       869 |       411 |
     103 |       864 |       414 |       865 |       415 |
     104 |       860 |       418 |       861 |       419 |
     105 |       856 |       422 |       857 |       423 |
     106 |       852 |       426 |       853 |       427 |
     107 |       848 |       430 |       849 |       431 |
     108 |       844 |       434 |       845 |       435 |
     109 |       840 |       438 |       841 |       439 |
     110 |       836 |       442 |       837 |       443 |
     111 |       832 |       446 |       833 |       447 |
     112 |       828 |       450 |       829 |       451 |
     113 |       824 |       454 |       825 |       455 |
     114 |       820 |       458 |       821 |       459 |
     115 |       816 |       462 |       817 |       463 |
     116 |       812 |       466 |       813 |       467 |
     117 |       808 |       470 |       809 |       471 |
     118 |       804 |       474 |       805 |       475 |
     119 |       800 |       478 |       801 |       479 |
     120 |       796 |       482 |       797 |       483 |
     121 |       792 |       486 |       793 |       487 |
     122 |       788 |       490 |       789 |       491 |
     123 |       784 |       494 |       785 |       495 |
     124 |       780 |       498 |       781 |       499 |
     125 |       776 |       502 |       777 |       503 |
     126 |       772 |       506 |       773 |       507 |
     127 |       768 |       510 |       769 |       511 |
     128 |       764 |       514 |       765 |       515 |
     129 |       760 |       518 |       761 |       519 |
     130 |       756 |       522 |       757 |       523 |
     131 |       752 |       526 |       753 |       527 |
     132 |       748 |       530 |       749 |       531 |
     133 |       744 |       534 |       745 |       535 |
     134 |       740 |       538 |       741 |       539 |
     135 |       736 |       542 |       737 |       543 |
     136 |       732 |       546 |       733 |       547 |
     137 |       728 |       550 |       729 |       551 |
     138 |       724 |       554 |       725 |       555 |
     139 |       720 |       558 |       721 |       559 |
     140 |       716 |       562 |       717 |       563 |
     141 |       712 |       566 |       713 |       567 |
     142 |       708 |       570 |       709 |       571 |
     143 |       704 |       574 |       705 |       575 |
     144 |       700 |       578 |       701 |       579 |
     145 |       696 |       582 |       697 |       583 |
     146 |       692 |       586 |       693 |       587 |
     147 |       688 |       590 |       689 |       591 |
     148 |       684 |       594 |       685 |       595 |
     149 |       680 |       598 |       681 |       599 |
     150 |       676 |       602 |       677 |       603 |
     151 |       672 |       606 |       673 |       607 |
     152 |       668 |       610 |       669 |       611 |
     153 |       664 |       614 |       665 |       615 |
     154 |       660 |       618 |       661 |       619 |
     155 |       656 |       622 |       657 |       623 |
     156 |       652 |       626 |       653 |       627 |
     157 |       648 |       630 |       649 |       631 |
     158 |       644 |       634 |       645 |       635 |
     159 |       640 |       638 |       641 |       639 |
     160 |       636 |       642 |       637 |       643 |
     161 |       632 |       646 |       633 |       647 |
     162 |       628 |       650 |       629 |       651 |
     163 |       624 |       654 |       625 |       655 |
     164 |       620 |       658 |       621 |       659 |
     165 |       616 |       662 |       617 |       663 |
     166 |       612 |       666 |       613 |       667 |
     167 |       608 |       670 |       609 |       671 |
     168 |       604 |       674 |       605 |       675 |
     169 |       600 |       678 |       601 |       679 |
     170 |       596 |       682 |       597 |       683 |
     171 |       592 |       686 |       593 |       687 |
     172 |       588 |       690 |       589 |       691 |
     173 |       584 |       694 |       585 |       695 |
     174 |       580 |       698 |       581 |       699 |
     175 |       576 |       702 |       577 |       703 |
     176 |       572 |       706 |       573 |       707 |
     177 |       568 |       710 |       569 |       711 |
     178 |       564 |       714 |       565 |       715 |
     179 |       560 |       718 |       561 |       719 |
     180 |       556 |       722 |       557 |       723 |
     181 |       552 |       726 |       553 |       727 |
     182 |       548 |       730 |       549 |       731 |
     183 |       544 |       734 |       545 |       735 |
     184 |       540 |       738 |       541 |       739 |
     185 |       536 |       742 |       537 |       743 |
     186 |       532 |       746 |       533 |       747 |
     187 |       528 |       750 |       529 |       751 |
     188 |       524 |       754 |       525 |       755 |
     189 |       520 |       758 |       521 |       759 |
     190 |       516 |       762 |       517 |       763 |
     191 |       512 |       766 |       513 |       767 |
     192 |       508 |       770 |       509 |       771 |
     193 |       504 |       774 |       505 |       775 |
     194 |       500 |       778 |       501 |       779 |
     195 |       496 |       782 |       497 |       783 |
     196 |       492 |       786 |       493 |       787 |
     197 |       488 |       790 |       489 |       791 |
     198 |       484 |       794 |       485 |       795 |
     199 |       480 |       798 |       481 |       799 |
     200 |       476 |       802 |       477 |       803 |
     201 |       472 |       806 |       473 |       807 |
     202 |       468 |       810 |       469 |       811 |
     203 |       464 |       814 |       465 |       815 |
     204 |       460 |       818 |       461 |       819 |
     205 |       456 |       822 |       457 |       823 |
     206 |       452 |       826 |       453 |       827 |
     207 |       448 |       830 |       449 |       831 |
     208 |       444 |       834 |       445 |       835 |
     209 |       440 |       838 |       441 |       839 |
     210 |       436 |       842 |       437 |       843 |
     211 |       432 |       846 |       433 |       847 |
     212 |       428 |       850 |       429 |       851 |
     213 |       424 |       854 |       425 |       855 |
     214 |       420 |       858 |       421 |       859 |
     215 |       416 |       862 |       417 |       863 |
     216 |       412 |       866 |       413 |       867 |
     217 |       408 |       870 |       409 |       871 |
     218 |       404 |       874 |       405 |       875 |
     219 |       400 |       878 |       401 |       879 |
     220 |       396 |       882 |       397 |       883 |
     221 |       392 |       886 |       393 |       887 |
     222 |       388 |       890 |       389 |       891 |
     223 |       384 |       894 |       385 |       895 |
     224 |       380 |       898 |       381 |       899 |
     225 |       376 |       902 |       377 |       903 |
     226 |       372 |       906 |       373 |       907 |
     227 |       368 |       910 |       369 |       911 |
     228 |       364 |       914 |       365 |       915 |
     229 |       360 |       918 |       361 |       919 |
     230 |       356 |       922 |       357 |       923 |
     231 |       352 |       926 |       353 |       927 |
     232 |       348 |       930 |       349 |       931 |
     233 |       344 |       934 |       345 |       935 |
     234 |       340 |       938 |       341 |       939 |
     235 |       336 |       942 |       337 |       943 |
     236 |       332 |       946 |       333 |       947 |
     237 |       328 |       950 |       329 |       951 |
     238 |       324 |       954 |       325 |       955 |
     239 |       320 |       958 |       321 |       959 |
     240 |       316 |       962 |       317 |       963 |
     241 |       312 |       966 |       313 |       967 |
     242 |       308 |       970 |       309 |       971 |
     243 |       304 |       974 |       305 |       975 |
     244 |       300 |       978 |       301 |       979 |
     245 |       296 |       982 |       297 |       983 |
     246 |       292 |       986 |       293 |       987 |
     247 |       288 |       990 |       289 |       991 |
     248 |       284 |       994 |       285 |       995 |
     249 |       280 |       998 |       281 |       999 |
     250 |       276 |      1002 |       277 |      1003 |
     251 |       272 |      1006 |       273 |      1007 |
     252 |       268 |      1010 |       269 |      1011 |
     253 |       264 |      1014 |       265 |      1015 |
     254 |       260 |      1018 |       261 |      1019 |
     255 |       256 |      1022 |       257 |      1023 |
     256 |       252 |      1026 |       253 |      1027 |
     257 |       248 |      1030 |       249 |      1031 |
     258 |       244 |      1034 |       245 |      1035 |
     259 |       240 |      1038 |       241 |      1039 |
     260 |       236 |      1042 |       237 |      1043 |
     261 |       232 |      1046 |       233 |      1047 |
     262 |       228 |      1050 |       229 |      1051 |
     263 |       224 |      1054 |       225 |      1055 |
     264 |       220 |      1058 |       221 |      1059 |
     265 |       216 |      1062 |       217 |      1063 |
     266 |       212 |      1066 |       213 |      1067 |
     267 |       208 |      1070 |       209 |      1071 |
     268 |       204 |      1074 |       205 |      1075 |
     269 |       200 |      1078 |       201 |      1079 |
     270 |       196 |      1082 |       197 |      1083 |
     271 |       192 |      1086 |       193 |      1087 |
     272 |       188 |      1090 |       189 |      1091 |
     273 |       184 |      1094 |       185 |      1095 |
     274 |       180 |      1098 |       181 |      1099 |
     275 |       176 |      1102 |       177 |      1103 |
     276 |       172 |      1106 |       173 |      1107 |
     277 |       168 |      1110 |       169 |      1111 |
     278 |       164 |      1114 |       165 |      1115 |
     279 |       160 |      1118 |       161 |      1119 |
     280 |       156 |      1122 |       157 |      1123 |
     281 |       152 |      1126 |       153 |      1127 |
     282 |       148 |      1130 |       149 |      1131 |
     283 |       144 |      1134 |       145 |      1135 |
     284 |       140 |      1138 |       141 |      1139 |
     285 |       136 |      1142 |       137 |      1143 |
     286 |       132 |      1146 |       133 |      1147 |
     287 |       128 |      1150 |       129 |      1151 |
     288 |       124 |      1154 |       125 |      1155 |
     289 |       120 |      1158 |       121 |      1159 |
     290 |       116 |      1162 |       117 |      1163 |
     291 |       112 |      1166 |       113 |      1167 |
     292 |       108 |      1170 |       109 |      1171 |
     293 |       104 |      1174 |       105 |      1175 |
     294 |       100 |      1178 |       101 |      1179 |
     295 |        96 |      1182 |        97 |      1183 |
     296 |        92 |      1186 |        93 |      1187 |
     297 |        88 |      1190 |        89 |      1191 |
     298 |        84 |      1194 |        85 |      1195 |
     299 |        80 |      1198 |        81 |      1199 |
     300 |        76 |      1202 |        77 |      1203 |
     301 |        72 |      1206 |        73 |      1207 |
     302 |        68 |      1210 |        69 |      1211 |
     303 |        64 |      1214 |        65 |      1215 |
     304 |        60 |      1218 |        61 |      1219 |
     305 |        56 |      1222 |        57 |      1223 |
     306 |        52 |      1226 |        53 |      1227 |
     307 |        48 |      1230 |        49 |      1231 |
     308 |        44 |      1234 |        45 |      1235 |
     309 |        40 |      1238 |        41 |      1239 |
     310 |        36 |      1242 |        37 |      1243 |
     311 |        32 |      1246 |        33 |      1247 |
     312 |        28 |      1250 |        29 |      1251 |
     313 |        24 |      1254 |        25 |      1255 |
     314 |        20 |      1258 |        21 |      1259 |
     315 |        16 |      1262 |        17 |      1263 |
     316 |        12 |      1266 |        13 |      1267 |
     317 |         8 |      1270 |         9 |      1271 |
     318 |         4 |      1274 |         5 |      1275 |
     319 |         0 |      1278 |         1 |      1279 |